<template>
    <div>
        <p>{{ count }}</p>
        <el-button @click="increment()">+1</el-button>
    <el-button @click="decrement()">-1</el-button>
  </div >
</template >

<script>
export default {
  data () {
    return {
      computed: {
        count () {
          return this.$store.state.count
        }
      },

      methods: {
        increment () {
          this.$store.commit('increment')
        },

        decrement () {
          this.$store.commit('decrement')


          this.$store.commit({
            type: 'decrement',
            count: 10
          })
        },

        increment () {
          this.$store.dispatch('increment', { decrement: 12 })
        },

        increment(){
              this.$store.dispatch('increment').then(res=>{
                  console.log('完成了更新操作')
              })
        }


      }
    }
  }
}

</script>

<style scoped>
</style>